import org.atmosphere.config.managed.Encoder;
import org.codehaus.jackson.map.ObjectMapper;

import java.io.IOException;

/**
 * Created by alex on 15-1-14.
 */
public class JacksonEncoders implements Encoder<Message,String>{
    //mapper
    private final ObjectMapper mapper = new ObjectMapper();

    @Override
    public String encode(Message message) {
        try {
            return mapper.writeValueAsString(message);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}



